package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.domain.db.AnalysisByDay;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface AnalysisByDayMapper extends BaseMapper<AnalysisByDay> {


    //累计用户
    @Select("SELECT sum(num_registered) FROM tb_analysis_by_day")
    Long sumCumulativeUsers();

    //活动用户
    @Select("SELECT sum(num_active) FROM tb_analysis_by_day WHERE record_date BETWEEN #{startTime} AND #{endTime}")
    Long sumActivePass(@Param("startTime") String startTime, @Param("endTime") String endTime);

    //指定日期
    @Select("SELECT * FROM tb_analysis_by_day WHERE record_date = #{recordDate}")
    AnalysisByDay findAnalysisByDay(String recordDate);


}